<template>
  <div class="no" @click="goto">
      <div class="auto">{{time}}秒后返回主页</div>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
import {onMounted, ref} from 'vue'
export default {
setup(){
    let router=useRouter()
    let goto=()=>{
        router.push('/home')
    }
    let time=ref(5)
    onMounted(()=>{
       let inter=setInterval(()=>{
           time.value--
           if(time.value==0){
               router.push('/home')
               clearInterval(inter)
           }
       },1000)
    })
    return {
        goto,time
    }
}
}
</script>

<style lang='less' scoped>
.no{
    width: 100%;
    height: 100%;
    background: url('../assets/img/404.jpg') no-repeat;
    background-size: 100%;
}
.auto{
    position: absolute;
    bottom: 25%;
    left: calc(50% - 100px);
    width: 200px;
    font-size: 24px;
    color: cyan;
}
</style>>

